|
|
 |
|
|
|
|
Private Sub Hilbert(ByVal depth As Integer, _
ByVal dx As Single, ByVal dy As Single)
If depth > 1 Then Hilbert depth - 1, dy, dx
Canvas.Line -Step(dx, dy)
If depth > 1 Then Hilbert depth - 1, dx, dy
Canvas.Line -Step(dy, dx)
If depth > 1 Then Hilbert depth - 1, dx, dy
Canvas.Line -Step(-dx, -dy)
If depth > 1 Then Hilbert depth - 1, -dy, -dx
End Sub |
|
|
|
|
|
|
|
|
Example program Hilbert uses this routine to draw Hilbert curves. Enter the depth of the curve you want to draw and click the Go button. Because some Hilbert curves take a long time to draw, you should run the program for relatively small levels (four or five) until you know how long the program takes on your computer. |
|
|
|
|
|
|
|
|
Hilbert curves have some properties that make them particularly useful as decorations. First, all the lines in a Hilbert curve are vertical or horizontal. That means all the lines have the same brightness and none suffers from the aliasing problems that sometimes affect diagonal line segments as described in Chapters 6 and 7. |
|
|
|
|
|
|
|
|
Second, computing the size of a Hilbert curve is relatively easy. If a depth N curve has line segments of length S, the total width and height of the curve is S * (2N 1). To think |
|
|
|
|
|
|
|
|
Figure 10.19
A box made from Hilbert curves. |
|
|
|
|
|